package top.infopub.mgr.bpa.service.impl;

import org.springframework.stereotype.Service;
import top.infopub.mgr.bpa.dao.BpaYearEffectDetailDao;
import top.infopub.mgr.bpa.service.BpaYearEffectDetailService;
import top.infopub.mgr.bpa.vo.BpaYearEffectDetail;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by wurz on 2021/6/20.
 */
@Service
public class BpaYearEffectDetailServiceImpl implements BpaYearEffectDetailService {
    @Resource
    private BpaYearEffectDetailDao bpaYearEffectDetailDao;


    @Override
    public int insert(BpaYearEffectDetail bpaYearEffectDetail) {
        return bpaYearEffectDetailDao.insert(bpaYearEffectDetail);
    }

    @Override
    public int deleteByPrimaryKey(String sguid) {
        return bpaYearEffectDetailDao.deleteByPrimaryKey(sguid);
    }

    @Override
    public int delete(BpaYearEffectDetail bpaYearEffectDetail) {
        return bpaYearEffectDetailDao.delete(bpaYearEffectDetail);
    }

    @Override
    public int updateByPrimaryKey(BpaYearEffectDetail bpaYearEffectDetail) {
        return bpaYearEffectDetailDao.updateByPrimaryKey(bpaYearEffectDetail);
    }

    @Override
    public BpaYearEffectDetail selectOne(String sguid) {
        return bpaYearEffectDetailDao.selectOne(sguid);
    }

    @Override
    public List<BpaYearEffectDetail> selectList(BpaYearEffectDetail bpaYearEffectDetail) {
        return bpaYearEffectDetailDao.selectList(bpaYearEffectDetail);
    }

    @Override
    public int selectCount(BpaYearEffectDetail bpaYearEffectDetail) {
        return bpaYearEffectDetailDao.selectCount(bpaYearEffectDetail);
    }

    @Override
    public int insertBatch(List<BpaYearEffectDetail> bpaYearEffectDetailList) {
        return bpaYearEffectDetailDao.insertBatch(bpaYearEffectDetailList);
    }

    @Override
    public void update(List<BpaYearEffectDetail> bpaYearEffectDetailList) {
        if (bpaYearEffectDetailList == null || bpaYearEffectDetailList.size() == 0){
            return;
        }
        bpaYearEffectDetailDao.deleteByNdId(bpaYearEffectDetailList.get(0).getNdId());
        this.insertBatch(bpaYearEffectDetailList);
    }
}
